package com.orangecy.common.cyioc;

import com.orangecy.common.cyioc.test.OrangeCyClient;

/**
 * @Author : orangeCy.奕
 * @Product : 猎豹养成产品源码
 * @Time : 2021/10/27
 * @Desc :
 */
public class CyContainerFactory {
    /**
     * 从猎豹容器获取clazz实例
     * @param clazz
     * @param <T>
     * @return
     */
    public static <T> T getBean(Class<T> clazz){
        CyCommonContainer cyCommonContainer = new CyCommonContainer();
        cyCommonContainer.registerBean(clazz);
        cyCommonContainer.initCyContainer();
        Object bean = cyCommonContainer.getBean(clazz);
        return (T) bean;
    }

    public static void main(String[] args) {
        OrangeCyClient bean = CyContainerFactory.getBean(OrangeCyClient.class);
        System.out.println(bean.xiaoYi("小奕"));
    }
}